cmd: Use autoptr for GKeyFile
authorColin Walters <walters@verbum.org>
Fri, 26 May 2017 21:53:49 +0000 (17:53 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Mon, 29 May 2017 14:09:08 +0000 (14:09 +0000)
Prep for code style conversion.

Closes: #891
Approved by: jlebon

src/ostree/ot-admin-builtin-deploy.c
src/ostree/ot-admin-builtin-switch.c

index e59bec8ef8c7c074d79ee971baa0b0dc5878e0e4..709c635e3ed96becba764afa94626ddab4ba2c2d 100644 (file)
@@ -56,7 +56,7 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
   const char *refspec;
   g_autoptr(GOptionContext) context = NULL;
   glnx_unref_object OstreeSysroot *sysroot = NULL;
-  GKeyFile *origin = NULL;
+  g_autoptr(GKeyFile) origin = NULL;
   glnx_unref_object OstreeRepo *repo = NULL;
   glnx_unref_object OstreeDeployment *new_deployment = NULL;
   glnx_unref_object OstreeDeployment *merge_deployment = NULL;
@@ -171,7 +171,5 @@ ot_admin_builtin_deploy (int argc, char **argv, GCancellable *cancellable, GErro
 
   ret = TRUE;
  out:
-  if (origin)
-    g_key_file_unref (origin);
   return ret;
 }
index d72aeebd254ed17e80103779ae050960a38d1179..9df77f05219b9b0e6354a2b662d05b10718c78e2 100644 (file)
@@ -58,7 +58,7 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
   glnx_unref_object OstreeAsyncProgress *progress = NULL;
   gboolean changed;
   GKeyFile *old_origin;
-  GKeyFile *new_origin = NULL;
+  g_autoptr(GKeyFile) new_origin = NULL;
 
   context = g_option_context_new ("REF - Construct new tree from REF and deploy it");
 
@@ -166,7 +166,5 @@ ot_admin_builtin_switch (int argc, char **argv, GCancellable *cancellable, GErro
 
   ret = TRUE;
  out:
-  if (new_origin)
-    g_key_file_unref (new_origin);
   return ret;
 }